package com.album.task;

import android.content.Context;

import com.album.http.HttpRequest;
import com.album.utils.Config;

public class GetFriendsTask extends Task{
	private String TAG = "HttpRspThread";
	private Context ctx;
	private ICallBack callBack;
	private String username;
	private int pageSize;
	private int pageNo;
	
	public GetFriendsTask(Context ctx,String username,int pageNo,int pageSize,ICallBack resTask){
		this.ctx = ctx;
		this.callBack = resTask;
		this.username = username;
		this.pageNo = pageNo;
		this.pageSize = pageSize;
	}
	public String setRequest(){
		String strUrl =Config.TyHttp + Config.TyFriendsHttp+
		"getfriendlist?passport="+username+"&pageNO="+pageNo+"&pageSize="+pageSize;
		//"http://59.36.102.177:55520" +
		//"/interface/friendmanage.jsp/getfriendlist?passport=18926128667@189.cn&pageSize=10&pageNO=1"
		String jsonString = HttpRequest.sendDataPost(ctx,strUrl, null,callBack);
		return jsonString;
	}
	@Override
	public void doTask(Task thread){
		Thread t = new Thread(thread);
		t.start();
	}
	@Override
	public void run() {
		//返回数据
		try {
			String strRsp = setRequest();
			callBack.CallBack(strRsp);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
